package edu.cueb.wmis.mapper;

import edu.cueb.wmis.pojo.Incomebill;
import edu.cueb.wmis.pojo.Incomebillitem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liuzizhuo
 * @since 2021-04-19
 */
public interface IncomebillitemMapper extends BaseMapper<Incomebillitem> {

    @Update("update tb_incomebillitem set goodId = #{goodId} where id=#{itemId}")
    void setItemGoodId(@Param("goodId") Integer goodId, @Param("itemId") Integer itemId);
    @Select("SELECT ii.* FROM tb_incomebillitem ii LEFT JOIN tb_incomebill ib ON ii.`billId` = ib.`id` WHERE ib.`inputTime` <= #{now}")
    List<Incomebillitem> getInGoodIds(LocalDate now);

    List<Incomebillitem> selectByYetBillId(List<Integer> inYetPdList);
}
